package com.aaa.controller.tables;

import com.aaa.dao.FReturnDao;
import com.aaa.dao.FReturnMapper;
import com.wsc.entity.FReturns;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("return")
public class FReturnController {
    @Resource
    FReturnMapper fReturnMapper;
    @Resource
    FReturnDao fReturnDao;
    @RequestMapping("select")
    public List<FReturns> select(){
        return fReturnMapper.selectList(null);
    }
    @RequestMapping("insert")
    public Integer insert(FReturns fReturns){
        return fReturnMapper.insert(fReturns);
    }
    @RequestMapping("delete")
    public Integer delete(Integer id){
        return fReturnMapper.deleteById(id);
    }
    @RequestMapping("update")
    public Integer update(FReturns fReturns){
        Date date1=new Date();
        SimpleDateFormat sfd=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String now = sfd.format(date1);
        fReturns.setReturntime(now);
        return fReturnMapper.updateById(fReturns);
    }
    @RequestMapping("select2")
    public Object select2(){
        return fReturnDao.select2();
    }
}
